package com.xl.rentkeeper.act.setting;

import android.os.Bundle;
import android.widget.TextView;

import com.xl.rentkeeper.App;
import com.xl.rentkeeper.R;
import com.xl.rentkeeper.act.BaseAct;
import com.xl.rentkeeper.view.TitleBar;

/**
 * Created by Administrator on 2015/8/21.
 */
public class ChangePwdAct extends BaseAct {
    private TextView mETOldPwd;
    private TextView mETNewPwd;
    private TextView mETReNewPwd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_change_pwd);

        TitleBar tb = (TitleBar) findViewById(R.id.tb);
        setTranslucentStatus();
        initTitleBar(tb);

        initView();

    }

    private void initView() {
        mETOldPwd = (TextView) findViewById(R.id.et_old_pwd);
        mETNewPwd = (TextView) findViewById(R.id.et_new_pwd);
        mETReNewPwd = (TextView) findViewById(R.id.et_reNew_pwd);
    }

    @Override
    public void icon2Click() {
        String mOldPwd = mETOldPwd.getText().toString().trim();
        String mNewPwd = mETNewPwd.getText().toString().trim();
        String mReNewPwd = mETReNewPwd.getText().toString().trim();

        if ("".equals(mOldPwd)){
            App.showToast("旧密码不能为空");
            return;
        }

        if (mNewPwd.length() < 6 || mNewPwd.length() >18 || mReNewPwd.length() <6 || mReNewPwd.length() >18){
            App.showToast("新密码位数不对");
            return;
        }else if (!mNewPwd.equals(mReNewPwd)){
            App.showToast("密码不一致");
            return;
        }
    }
}
